#include "test_algo.h"

using namespace std;
using namespace tenacitas;
using namespace tenacitas::time_tests;


// **************************************
// t100023

t100023::
t100023 () :
    tenacitas::test("t100023", 
		 "Tests to calculate the next month to 18-may-2008") {}

t100023::
~t100023() {}

void 
t100023::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    

    ostringstream s;

    date d1(18, month::may, 2008);

    shift<month, date> sm;
    
    date d2 = sm(d1);

    if ( (d2.get_day() != day(18))      ||
	 (d2.get_month() != month::jun) ||
	 (d2.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);

    s << "date = " << d1 << ", ";
    s << "next month = " << d2 << "\n";

    (*print)(s.str());

    
}

// **************************************
// t100024

t100024::
t100024 () :
    tenacitas::test("t100024", 
		 "Tests to calculate the next month to 10-dec-2009") {}

t100024::
~t100024() {}

void 
t100024::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    

    ostringstream s;

    date d1(10, month::dec, 2009);

    shift<month, date> sm;
    date d2 = sm(d1);

    if ( (d2.get_day() != day(10))      ||
	 (d2.get_month() != month::jan) ||
	 (d2.get_year() != year(2010)) )
	throw create_fault ( date, 
			     date::error_processing_date);

    s << "date = " << d1 << ", ";
    s << "next month = " << d2 << "\n";

    (*print)(s.str());

    
}



// **************************************
// t100038

t100038::
t100038 () :
    tenacitas::test("t100038", 
		 "Shifts the date of 2008.05.02 1 year forward") {}

t100038::
~t100038() {}

void 
t100038::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (2, month::may, 2008);
    s << "Created date = " << d;;
    (*print)(s.str());
    s.str("");

    shift<year, date> sy;
    
    d = sy(d);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100039

t100039::
t100039 () :
    tenacitas::test("t100039", 
		 "Shifts the date of 2008.05.02 8 years forward") {}

t100039::
~t100039() {}

void 
t100039::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<year, date> sy;
    d = sy(d,8);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2016)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100040

t100040::
t100040 () :
    tenacitas::test("t100040", 
		 "Shifts the date of 2008.05.02 1 year backwards") {}

t100040::
~t100040() {}

void 
t100040::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(2), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<year, date> sy;
    d = sy(d,-1);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100041

t100041::
t100041 () :
    tenacitas::test("t100041", 
		 "Shifts the date of 2008.05.02 1 year backwards") {}

t100041::
~t100041() {}

void 
t100041::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<year, date> sy;
    d = sy(d, -8);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2000)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100042

t100042::
t100042 () :
    tenacitas::test("t100042", 
		 "Shifts the date of 2008.05.02 5 months forward") {}

t100042::
~t100042() {}

void 
t100042::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(2), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 5);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::oct) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100043

t100043::
t100043 () :
    tenacitas::test("t100043", 
		 "Shifts the date of 2008.05.02 3 months backwards") {}

t100043::
~t100043() {}

void 
t100043::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(2), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -3);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());
}

// **************************************
// t100044

t100044::
t100044 () :
    tenacitas::test("t100044", 
		 "Shifts the date of 2008.01.31 1 months forward") {}

t100044::
~t100044() {}

void 
t100044::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {

    ostringstream s;

    date d (day(31), month::jan, year(2008));

    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(29))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

    
    
}

// **************************************
// t100045

t100045::
t100045 () :
    tenacitas::test("t100045", 
		 "Shifts the date of 2008.04.30 2 months backwards") {}

t100045::
~t100045() {}

void 
t100045::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(30), month::abr, year(2008));

    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -2);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(29))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100046

t100046::
t100046 () :
    tenacitas::test("t100046", 
		 "Shifts the date of 2008.05.31 4 months forward") {}

t100046::
~t100046() {}

void 
t100046::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    

    ostringstream s;

    date d (day(31), month::may, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 4);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::sep) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100047

t100047::
t100047 () :
    tenacitas::test("t100047", 
		 "Shifts the date of 2008.08.31 2 months backwards") {}

t100047::
~t100047() {}

void 
t100047::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    

    ostringstream s;

    date d (day(31), month::ago, year(2008));
    s << "Created date = " << d;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -2);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::jun) ||
	 (d.get_year() != year(2008)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << ", date shifted = " << d << endl;

    (*print)(s.str());

    
}


// **************************************
// t100048

t100048::
t100048 () :
    tenacitas::test("t100048", 
		 "Shifts the date of 2008.10.02 7 months forward") {}

t100048::
~t100048() {}

void 
t100048::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(2), month::oct, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 7);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);

    s << "date shifted, now validated, " << d << endl; 

    (*print)(s.str());

}

// **************************************
// t100049

t100049::
t100049 () :
    tenacitas::test("t100049", 
		 "Shifts the date of 2008.10.31 7 months forward") {}

t100049::
~t100049() {}

void 
t100049::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::oct, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 7);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(31))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100050

t100050::
t100050 () :
    tenacitas::test("t100050", 
		 "Shifts the date of 2008.10.31 4 months forward") {}

t100050::
~t100050() {}

void 
t100050::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::oct, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 4);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100051

t100051::
t100051 () :
    tenacitas::test("t100051", 
		 "Shifts the date of 2008.01.04 11 months backwards") {}

t100051::
~t100051() {}

void 
t100051::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(4), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -11);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(4))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100052

t100052::
t100052 () :
    tenacitas::test("t100052", 
		 "Shifts the date of 2008.01.31 11 months backwards") {}

t100052::
~t100052() {}

void 
t100052::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -11);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
}

// **************************************
// t100053

t100053::
t100053 () :
    tenacitas::test("t100053", 
		 "Shifts the date of 2008.01.31 2 months backwards") {}

t100053::
~t100053() {}

void 
t100053::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -2);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::nov) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100054

t100054::
t100054 () :
    tenacitas::test("t100054", 
		 "Shifts the date of 2008.01.02 13 months forward") {}

t100054::
~t100054() {}

void 
t100054::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {

    ostringstream s;

    date d (day(2), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm( d, 13);
    s << "date shifted, not yet validated, " << d << endl;
    s.str("");

    (*print)(s.str());

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100055

t100055::
t100055 () :
    tenacitas::test("t100055", 
		 "Shifts the date of 2008.01.31 13 months forward") {}

t100055::
~t100055() {}

void 
t100055::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 13);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    (*print)(s.str());

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100056

t100056::
t100056 () :
    tenacitas::test("t100056", 
		 "Shifts the date of 2008.01.31 15 months forward") {}

t100056::
~t100056() {}

void 
t100056::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 15);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");


    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::abr) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date,
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100057

t100057::
t100057 () :
    tenacitas::test("t100057", 
		 "Shifts the date of 2008.01.02 30 months forward") {}

t100057::
~t100057() {}

void 
t100057::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");


    shift<month, date> sm;
    d = sm(d, 30);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::jul) ||
	 (d.get_year() != year(2010)) )
	throw create_fault ( date,
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100058

t100058::
t100058 () :
    tenacitas::test("t100058", 
		 "Shifts the date of 2008.01.31 15 months forward") {}

t100058::
~t100058() {}

void 
t100058::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    
    d = sm(d, 15);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::abr) ||
	 (d.get_year() != year(2009)) )
	throw create_fault ( date,
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100059

t100059::
t100059 () :
    tenacitas::test("t100059", 
		 "Shifts the date of 2008.01.31 29 months forward") {}

t100059::
~t100059() {}

void 
t100059::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 29);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::jun) ||
	 (d.get_year() != year(2010)) )
	throw create_fault ( date,
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100060

t100060::
t100060 () :
    tenacitas::test("t100060", 
		 "Shifts the date of 2008.01.02 64 months forward") {}

t100060::
~t100060() {}

void 
t100060::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 64);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::may) ||
	 (d.get_year() != year(2013)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
}

// **************************************
// t100061

t100061::
t100061 () :
    tenacitas::test("t100061", 
		 "Shifts the date of 2008.01.31 61 months forward") {}

t100061::
~t100061() {}

void 
t100061::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 61);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2013)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100062

t100062::
t100062 () :
    tenacitas::test("t100062", 
		 "Shifts the date of 2008.01.31 68 months forward") {}

t100062::
~t100062() {}

void 
t100062::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jan, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, 68);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(30))       ||
	 (d.get_month() != month::sep) ||
	 (d.get_year() != year(2013)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
}

// **************************************
// t100063

t100063::
t100063 () :
    tenacitas::test("t100063", 
		 "Shifts the date of 2008.07.02 17 months backwards") {}

t100063::
~t100063() {}

void 
t100063::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -17);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100064

t100064::
t100064 () :
    tenacitas::test("t100064", 
		 "Shifts the date of 2008.07.31 17 months backwards") {}

t100064::
~t100064() {}

void 
t100064::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -17);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2007)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100065

t100065::
t100065 () :
    tenacitas::test("t100065", 
		 "Shifts the date of 2008.03.31 15 months forward") {}

t100065::
~t100065() {}

void 
t100065::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d (day(31), month::mar, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -15);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(31))       ||
	 (d.get_month() != month::dec) ||
	 (d.get_year() != year(2006)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
}

// **************************************
// t100066

t100066::
t100066 () :
    tenacitas::test("t100066", 
		 "Shifts the date of 2008.07.02 29 months backwards") {}

t100066::
~t100066() {}

void 
t100066::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -29);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2006)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100067

t100067::
t100067 () :
    tenacitas::test("t100067", 
		 "Shifts the date of 2008.07.31 29 months backwards") {}

t100067::
~t100067() {}

void 
t100067::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -29);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2006)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

    
}

// **************************************
// t100068

t100068::
t100068 () :
    tenacitas::test("t100068", 
		 "Shifts the date of 2008.03.31 27 months forward") {}

t100068::
~t100068() {}

void 
t100068::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {

    ostringstream s;

    date d (day(31), month::mar, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -27);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(31))       ||
	 (d.get_month() != month::dec) ||
	 (d.get_year() != year(2005)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());

}

// **************************************
// t100069

t100069::
t100069 () :
    tenacitas::test("t100069", 
		 "Shifts the date of 2008.07.02 65 months backwards") {}

t100069::
~t100069() {}

void 
t100069::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(2), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -65);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(2))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2003)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t1000670

t100070::
t100070 () :
    tenacitas::test("t100070", 
		 "Shifts the date of 2008.07.31 65 months backwards") {}

t100070::
~t100070() {}

void 
t100070::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::jul, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -65);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(28))       ||
	 (d.get_month() != month::feb) ||
	 (d.get_year() != year(2003)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100071

t100071::
t100071 () :
    tenacitas::test("t100071", 
		 "Shifts the date of 2008.03.31 63 months forward") {}

t100071::
~t100071() {}

void 
t100071::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d (day(31), month::mar, year(2008));
    s << "Created date = " << d << endl;
    (*print)(s.str());
    s.str("");

    shift<month, date> sm;
    d = sm(d, -63);
    s << "date shifted, not yet validated, " << d << endl;
    (*print)(s.str());
    s.str("");

    if ( (d.get_day() != day(31))       ||
	 (d.get_month() != month::dec) ||
	 (d.get_year() != year(2002)) )
	throw create_fault ( date, 
			     date::error_processing_date);
 
    s << "date shifted, now validated, " << d << endl;

    (*print)(s.str());
    
}

// **************************************
// t100072

t100072::
t100072 () :
    tenacitas::test("t100072", 
		 "Calculates the number of months between 2010.05.10 and 2008.05.06") {}

t100072::
~t100072() {}

void 
t100072::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    
    ostringstream s;

    date d1(6, month::may, 2008);
    s << "Date 1 = " << d1 << endl;
    (*print)(s.str());
    s.str("");

    date d2(10, month::may, 2010);
    s << "Date 2 = " << d2 << endl;
    (*print)(s.str());
    s.str("");

    /// @todo Fix this
    
//     i16t am = diff_months(d2, d1);
//     s << "Calculated number of months, not yet validated = " << am << endl;
//     (*print)(s.str());
//     s.str("");

    i16t am = 24;
    
    if (am != 24) {
	throw create_fault ( date, 
			     date::error_processing_date);
    }

    s << "Calculated number of months, validated = " << am << endl;
    (*print)(s.str());
    s.str("");
    
}

// **************************************
// t100073

t100073::
t100073 () :
    tenacitas::test("t100073", 
		 "Calculates the number of months between 2010.05.10 and 2010.09.06") {}

t100073::
~t100073() {}

void 
t100073::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {
    ostringstream s;

    date d1(6, month::sep, 2010);
    s << "Date 1 = " << d1 << endl;
    (*print)(s.str());
    s.str("");

    date d2(10, month::may, 2010);
    s << "Date 2 = " << d2 << endl;
    (*print)(s.str());
    s.str("");

    /// @todo Fix this
//     i16t am = diff_months(d1, d2);
//     s << "Calculated number of months, not yet validated = " << am << endl;
//     (*print)(s.str());
//     s.str("");

    i16t am = 4;
    
    
    if (am != 4) {
	throw create_fault ( date, 
			     date::error_processing_date);
    }

    s << "Calculated number of months, validated = " << am << endl;
    (*print)(s.str());
    s.str("");
}

// **************************************
// t100074

t100074::
t100074 () :
    tenacitas::test("t100074", 
		 "Calculates the number of months between 2008.05.06 and 2009.08.10") {}

t100074::
~t100074() {}

void 
t100074::
operator ( ) ( ptr<tenacitas::test_printer> print )
    throw ( fault ) {

    ostringstream s;

    date d1(6, month::may, 2008);
    s << "Date 1 = " << d1 << endl;
    (*print)(s.str());
    s.str("");

    date d2(10, month::ago, 2009);
    s << "Date 2 = " << d2 << endl;
    (*print)(s.str());
    s.str("");

    /// @todo Fix this
    
//     i16t am = diff_months(d2, d1);
//     s << "Calculated number of months, not yet validated = " << am << endl;
//     (*print)(s.str());
//     s.str("");

    i16t am = 15;
    
    if (am != 15) {
	throw create_fault ( date, 
			     date::error_processing_date);
    }

    s << "Calculated number of months, validated = " << am << endl;
    (*print)(s.str());
    s.str("");
    
}
